package com.chis.filetest;

import com.chis.util.RandomGUID;

import java.io.File;

/**
 * 
 * @Description 
 * @Company zwx
 * @author wlj
 * @version 2019年03月25日
 */
public class Test {

    public static void main(String[] args) {
        traverseFolder("C:\\Users\\wlj\\Desktop\\2020-06-23");
    }


    public static void traverseFolder(String path) {
        File file = new File(path);
        if (file.exists()) {
            File[] files = file.listFiles();
            if (null == files || files.length == 0) {
                return;
            } else {
                for (File file2 : files) {
                    if (file2.isDirectory()) {
                        traverseFolder(file2.getAbsolutePath());
                    } else {
                        if (file2.getAbsolutePath().endsWith(".zip")) {
                            String filename = file2.getAbsolutePath().substring((file2.getAbsolutePath().lastIndexOf("\\"))+1);
                            System.out.println(filename);
                            //File newName = new File("C:\\Users\\Administrator\\Desktop\\elecTools\\JxcElecUpLoad\\files\\"+filename);
                            //file2.renameTo(newName);
                        }
                    }
                }
            }
        } else {
            System.out.println("文件不存在!");
        }
    }

}
